﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using System.ComponentModel;

namespace FortuneCat.WebUI.Models {
    public class SaveBalanceViewModel {
        public int Id { get; set; }

        [Required(ErrorMessage = "请选择收支类型")]
        [DisplayName("类型:")]
        public bool IsReceipt { get; set; }

        [Required(ErrorMessage = "请选择日期")]
        [DisplayName("日期:")]
        public DateTime BalanceDate { get; set; }

        [Required(ErrorMessage = "请填写金额")]
        [Range(0.01, double.MaxValue, ErrorMessage = "金额应大于零")]
        [RegularExpression(@"^\d*(\.\d{1,2})*$", ErrorMessage = "请填写有效的金额")]
        [DisplayName("金额:")]
        public decimal Amount { get; set; }

        [Required(ErrorMessage = "请填写原由")]
        [DisplayName("原由:")]
        public string Reason { get; set; }

        [Required(ErrorMessage = "请指定收支人")]
        [DisplayName("收支人:")]
        public int UserId { get; set; }


        public SelectList Users { get; set; }
    }
}